#
# Properties
#

# 
# Custom Accessor for pH+ Objects
# TODO: Look for a more efficient way to do this?
class Module
  def phplus_property(*symbols)
    symbols.each do |s|
      class_eval %{
        def #{s}= (what)
          @properties[:#{s}] = Ph::Property.new("#{s}") unless @properties.has_key? :#{s}  
          @properties[:#{s}].value = what
        end
      
        def #{s}
          @properties[:#{s}] = Ph::Property.new("#{s}") unless @properties.has_key? :#{s}  
          @properties[:#{s}].value
        end 
      }
    end
  end
end

module Ph
  
  class Property
  
    attr_accessor :name, :value
    
    def initialize(name, value=nil)
      @name = name
      @value = value
    end
           
    def to_s
      if (@value == true) then return " #@name"	end	
      
		  return (@value != nil) ? " #@name='#@value'" : ''
    end
    
    def to_js
      
    end  
  
  end
  
end
